Skip to main content

Bug Tracker

Side navigation

Ticket #4283: 4283 Temporary Fix.txt
File 4283 Temporary Fix.txt, 0.8 KB (added by andrew_, March 26, 2009 03:52PM UTC)

Temporary Fix - Not a Patch

/*
 *  $().attr proxy. http://dev.jquery.com/ticket/4283. We need to handle some things special until this gets taken care of.
 */
(function($){
	var attr = $.prototype.attr;
	$.prototype.attr = function(name, value, type){
		if(typeof name == 'string' && name.toLowerCase() == 'checked'){
			var val;
			if((typeof value == 'string' && value.length && value == 'checked'))
				val = true;
			else
				val = false;
				
			return this.each(function(){
				this.checked = val;
			});		
		}
		return attr.call(this, name, value, type);
	};

	var removeAttr = $.prototype.removeAttr;
	$.prototype.removeAttr = function(name){
		if(name.toLowerCase() == 'checked'){
			return this.each(function(){
				this.checked = false;
			});		
		}
		return removeAttr.call(this, name);
	};
})(jQuery);

Download in other formats:

Original Format